home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Rectangle;
- import java.io.DataInputStream;
- import java.io.IOException;
-
- final class ColButton extends ColObj {
- private long urlIndex;
- public int drawState = 1;
- private int prevdrawState = 1;
- protected ColGrph m_colGraphicObj;
- boolean hasOverSound;
- boolean hasDownSound;
- private ColObjIntr upState;
- private ColObjIntr dnState;
- private ColObjIntr ovState;
- private ColObjIntr overSoundObj;
- private ColObjIntr downSoundObj;
- public Rectangle m_bounds;
-
- public boolean EventProc(Event var1) {
- boolean var2 = false;
- int var3 = (int)(((float)var1.x + this.m_colGraphicObj.m_xOrg * this.m_colGraphicObj.m_mag) / this.m_colGraphicObj.m_mag);
- int var4 = (int)(((float)var1.y + this.m_colGraphicObj.m_yOrg * this.m_colGraphicObj.m_mag) / this.m_colGraphicObj.m_mag);
- if (var1.id == 502) {
- if (this.m_bounds.inside(var3, var4)) {
- this.drawState = 3;
- var2 = false;
- }
-
- this.m_colGraphicObj.m_appComp.buttonisDn = false;
- }
-
- if (var1.id == 501 && this.m_bounds.inside(var3, var4)) {
- this.drawState = 2;
- this.m_colGraphicObj.m_appComp.buttonisDn = true;
- var2 = true;
- }
-
- if (var1.id == 503 || var1.id == 506) {
- if (this.m_bounds.inside(var3, var4)) {
- this.drawState = 3;
- var2 = false;
- } else {
- this.drawState = 1;
- }
-
- if (var1.id == 506) {
- this.m_colGraphicObj.m_appComp.buttonisDn = true;
- if (this.m_bounds.inside(var3, var4)) {
- this.drawState = 2;
- var2 = true;
- }
- }
- }
-
- if (var1.id == 505) {
- this.drawState = 1;
- this.m_colGraphicObj.m_appComp.buttonisDn = false;
- }
-
- if (this.prevdrawState != this.drawState) {
- this.draw(this.m_colGraphicObj.m_appComp.getGraphics());
- }
-
- return var2;
- }
-
- public void draw(Graphics var1) {
- if (this.drawState == 1) {
- this.upState.draw(var1);
- } else if (this.drawState == 2) {
- if (this.hasDownSound && this.downSoundObj != null) {
- ((ColSnd)this.downSoundObj).PlayClip();
- }
-
- this.dnState.draw(var1);
- } else {
- if (this.hasOverSound && this.overSoundObj != null) {
- ((ColSnd)this.overSoundObj).PlayClip();
- }
-
- this.ovState.draw(var1);
- }
-
- this.prevdrawState = this.drawState;
- }
-
- public ColButton(DataInputStream var1, int var2, ColGrph var3, Graphics var4) throws IOException {
- int var5 = var1.readInt();
- this.m_colGraphicObj = var3;
- this.m_bounds = new Rectangle();
- this.m_bounds.y = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.x = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.height = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.width = (int)((float)var1.readInt() / 65536.0F);
- this.hasOverSound = var1.readInt() == 1;
- this.hasDownSound = var1.readInt() == 1;
- this.upState = var3.m_appComp.m_colDoc.ReadNextObj(var1);
- ((ColImg)this.upState).useOffScreen = 1;
- this.ovState = var3.m_appComp.m_colDoc.ReadNextObj(var1);
- ((ColImg)this.ovState).useOffScreen = 1;
- this.dnState = var3.m_appComp.m_colDoc.ReadNextObj(var1);
- ((ColImg)this.dnState).useOffScreen = 1;
- if (this.hasOverSound) {
- this.overSoundObj = var3.m_appComp.m_colDoc.ReadNextObj(var1);
- }
-
- if (this.hasDownSound) {
- this.downSoundObj = var3.m_appComp.m_colDoc.ReadNextObj(var1);
- }
-
- }
-
- public int getType() {
- return 13;
- }
-
- public Rectangle getBounds() {
- return this.m_bounds;
- }
- }
-